import unittest
from time import sleep
from page.page_login import PageLogin
from base.get_driver import GetDriver


class Test1(unittest.TestCase):
    login = None
    driver = None

    @classmethod
    def setUpClass(cls):
        # 初始化驱动
        cls.driver = GetDriver.Device()
        # 初始化 PageLogin 对象
        cls.login = PageLogin(cls.driver)
        # 影视等待
        cls.driver.implicitly_wait(10)

    @classmethod
    def tearDownClass(cls):

        # 关闭驱动
        cls.driver.quit()

    def test_1(self):
        # 点击桌面上的商城app
        self.login.page_click_app()
        # #点击兰蔻粉水轻柔
        self.login.page_click_goods()
        # 点击登录
        # self.login.page_click_logged()
        # 点击立即购买
        self.login.page_click_Buy()
        # 点击加号
        self.login.page_click_add()
        # 点击加入购物车
        self.login.page_click_add_shopping_cart()
        # 点击商品详情里面的返回
        self.login.page_return3()
        # 点击购物车
        self.login.page_click_shopping_cart()
        # 点击全选
        self.login.page_click_select_all()
        # 点击结算
        self.login.page_click_check_out()
        # 点击提交订单
        self.login.page_click_type_orde()
        # 点击查看订单
        self.login.page_click_look_order()
        # 点击订单列表里面的返回
        for _ in range(3):
            self.login.page_click_return4()
            sleep(1)
        # 点击我的
        self.login.page_click_my()
        # 向下滑动
        self.login.page_downward()


